package io.github.talelin.latticy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.github.talelin.latticy.model.BookDO;
import io.github.talelin.latticy.model.CourseDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author pedro@TaleLin
 */
@Repository
public interface CourseMapper extends BaseMapper<CourseDO> {

    /**
     * 根据teacherId查询所有课程
     * @param teacherId 老师id
     * @return List<CourseDO>
     */
    List<CourseDO> getByTeacherId(@Param(value = "teacherId") Long teacherId);

    /**
     * 根据关键字获取课程
     * @param title 关键字
     * @return CourseDO
     */
    List<CourseDO> getCourseByTitle(@Param(value = "title") String title);

    /**
     * 判断是否有重复的课程名
     * @param title 课程名
     * @return  int
     */
    int hasCourseExisted(@Param(value = "title") String title);
}
